<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?>
<title><?= $sf_response->getTitle() ?></title>
<?php use_helper('DateForm') ?>
<?php use_stylesheet('excelbutton') ?>
<?php use_stylesheet('/sf/sf_admin/css/main') ?>


<div id="sf_admin_container">

<h1><?php 

    if ($local) 
        echo 'Local Receivable - Tally in';
    else
        echo 'Oversea Receivable - Tally in';
    
?></h1>

<div id="sf_admin_content">
<?php echo form_tag('report/TallyinOR', array(
  'id'        => 'sf_admin_edit_form',
  'name'      => 'sf_admin_edit_form',
  'multipart' => true,
)) ?>

<?php echo input_hidden_tag('local', $local) ?>
<fieldset id="sf_fieldset_none" class="">

<div class="form-row">
  <label for="client_name" class="required">From Date:</label>  
  <div class="content">  
  <?php echo select_month_tag('filters[frommonth]', isset($filters['frommonth']) ? $filters['frommonth'] : 1) ?>
  <?php echo select_year_tag('filters[fromyear]', isset($filters['fromyear']) ? $filters['fromyear'] : null) ?>
    </div>
</div>

<div class="form-row">
  <label for="client_name" class="required">To Date:</label>  
  <div class="content">    
  <?php echo select_month_tag('filters[tomonth]', isset($filters['tomonth']) ? $filters['tomonth'] : null) ?>
  <?php echo select_year_tag('filters[toyear]', isset($filters['toyear']) ? $filters['toyear'] : null) ?>
  </div>
</div>


</fieldset>
<ul class="sf_admin_actions">
  <li><?php echo submit_tag(__('Report'), array (
  'name' => 'report',
  'class' => 'sf_admin_action_save',
)) ?></li>
   <li><?php echo submit_tag(__('Export To Excel'), array (
  'name' => 'ExportToExcel',
  'class' => 'sf_admin_action_save',
)) ?></li>
  
      
</ul>

</form>

<? 
if (isset($result) && count($result)) {
////input data
$ydata1 = array_values($result['Partially']);
$ydata2 = array_values($result['Fully']);
$ydata3 = array_values($result['Total']);

 $keysRow = array_keys( $result );
 $keysCol = array_keys($result[$keysRow[0]]); 
 
 include('barlinealphachart.php');
?>

<BR/><BR/><BR/><BR/>
<table width="100%" border="1" cellpadding="0" cellspacing="0" class="textalignright">
    <tr>
        <td style="text-align:justify"><b>PO STATUS</b></td>
    <?     
    foreach ($keysCol as $key) 
    {
    ?>
        <td style="text-align:justify" ><strong><? echo $key?></strong></td>
    <?    
    }
    ?>
  </tr>
<? 
$count = 0;
foreach ($keysRow as $row)
{
?>
  <tr>
    <td style="text-align:justify"><b><?echo $row?></b></td>
    
    <? foreach ($keysCol as $col) 
    {
    ?>
        <td style="text-align:right"><? echo $result[$row][$col] ?></td>
    <?    
    }
    ?>
    
  </tr>
<?
}
?>
</table>

<?}?>

</div>

</div>